/*
	鸡x 兔为y
	x+y=head
	2x+4y=foot
	y= (foot - (2*head))/2
	x=head-y
*/
#include<stdio.h>

int main(void)
{
	int head,foot,x,y;
	scanf("%d%d",&head,&foot);
	y=(foot-2*head)/2;
	x=head-y;
	printf("%d %d\n",x,y);
	return 0;
}
